// <copyright file="User.cs" company="EnterpriseApi">
// Copyright (c) EnterpriseApi. All rights reserved.
// </copyright>

namespace EnterpriseApi.Models;

/// <summary>
/// 用户实体类，代表系统中的用户
/// </summary>
public class User
{
    /// <summary>
    /// 用户唯一标识符
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 用户名
    /// </summary>
    public required string Username { get; set; }

    /// <summary>
    /// 用户密码（加密存储）
    /// </summary>
    public required string PasswordHash { get; set; }

    /// <summary>
    /// 用户邮箱
    /// </summary>
    public required string Email { get; set; }

    /// <summary>
    /// 用户手机号码
    /// </summary>
    public string? PhoneNumber { get; set; }

    /// <summary>
    /// 用户创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

    /// <summary>
    /// 用户最后更新时间
    /// </summary>
    public DateTime? UpdatedAt { get; set; }

    /// <summary>
    /// 用户是否活跃
    /// </summary>
    public bool IsActive { get; set; } = true;

    /// <summary>
    /// 用户所属角色的导航属性
    /// </summary>
    public int RoleId { get; set; }
    public Role Role { get; set; } = null!;
}